<?php 
ini_set('max_execution_time',10000);
ini_set('display_errors',0);
my_component_load('testing' , false);
my_component_load('paging' , false); 
my_component_load('xl_builder' , false);  
my_component_load('list_kalender' , false);   
my_component_load('rpt_jadwal_karyawan' );
$task = isset($_GET['task']) ? $_GET['task'] : "";  
$tanggal = isset($_GET['tanggal']) ? $_GET['tanggal'] : "";  
$field = isset($_GET['field']) ? $_GET['field'] : "";  
$value = isset($_GET['value']) ? $_GET['value'] : "";  
$id = isset( $_GET['id'] ) ? $_GET['id']:  0; 
$query = "SELECT MAX(periode_id) AS maxd FROM tmn_hari_realisasi LIMIT 1";
$result = my_query($query);
$row = my_fetch_array($result);
$periode_id = isset( $_GET['periode_id'] ) ? $_GET['periode_id']:   ($row['maxd'] );
$karyawan_id = isset( $_GET['karyawan_id'] ) ? $_GET['karyawan_id']:  0;  

$modulname = "Laporan _BN_ Waktu Kerja _BN_ Realisasi jadwal";
if( $task == 'excel' ){ 
	header("Content-Type: application/xls");
	header("Content-Disposition: attachment;filename=realisasi_waktu_kerja.xls");
	echo excel_hari_kerja($periode_id);
	exit;
}elseif( $task == 'download_all_data' ){
	header("Content-Type: application/xls");
	header("Content-Disposition: attachment;filename=realisasi_waktu_kerja.xls");
	$nik_start 	= isset($_GET['nik_start']) ? $_GET['nik_start'] : 0;
	$nik_end	= isset($_GET['nik_end']) ? $_GET['nik_end']: 0;
	echo list_report_realisasi( $periode_id , $nik_start , $nik_end );
	exit;
}elseif( $task == 'form_search_report_page' ){
		$content = form_download_excel();
		generate_my_web($content, '' ,'plain.php' );
		exit;
}elseif( $task == 'form_search_report' ){
	$title= ($id > '0' ) ?  "Perubahan data jabatan" : "Tambah data jabatan";
	facebox_page('index.php?com='.$_GET['com'].'&task=form_search_report_page'  , $title , 200	); 
}elseif( $task == 'list_detail' ){
	$content = detail_realisasi_karyawan($karyawan_id , $periode_id);
}else{load_facebox_script();
	$content = list_karyawan_realisasi($periode_id);
}
generate_my_web($content, $pagename );